package denisLunchy;

import java.util.ArrayList;
import java.util.List;

public class Order extends LunchyClass {
	public ArrayList<Dish> arrayDish = new ArrayList<Dish>();
	private Client client;
	private int cost;
	private int id;
	int sumCost;

	public Client addClient(String name, String surname) {
		Client client = new Client();
		client.setNameClient(name);
		client.setSurName(surname);
		return client;

	}

	@Override
	public void addItem(Dish d) {
		arrayDish.add(d);

	}

	@Override
	public void removeItem(Dish d) {
		for (int i = 0; i < arrayDish.size(); i++) {
			if (d.setId() == arrayDish.get(i).setId()) {
				arrayDish.remove(i);
			}
		}
	}

	public int getCost() {
		return cost;
	}

	public void setCost(int cost) {
		this.cost = cost;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Client getClient() {
		return client;
	}

	public void setClient(Client client) {
		this.client = client;
	}
	public int getSumCost(){
		int sum=0;
		for(Dish dish:arrayDish){
			sum=sum+dish.getCost();
		}
		return sum;
	}

}
